#include <stdlib.h>
#include <string.h>
#include <stdio.h>

#include <TabLite.h>

void TabElemDump(TabElem* elem)
{
    if (!elem)
    {
        TabErrorSet(TAB_ERROR_ARG); 
        return;
    }
    printf("====TabElem Start====\n");
    printf("tag: %x ", elem->tag);
    switch (elem->tag)
    {
    case TAB_TAG_DEC:
        printf("DEC\n", elem->valDec);
        break;
    case TAB_TAG_HEX:
        printf("HEX\n", elem->valHex);
        break;
    case TAB_TAG_INT:
        printf("INT\n", elem->valInt);
        break;
    case TAB_TAG_STR:
        printf("STR\n", elem->valStr);
        break;
    case TAB_TAG_TAB:
        printf("TAB\n", elem->valTab);
        break;
    default:
        printf("NIL\n");
        break;
    }
    printf("hash: %d\n", elem->hashKey);
    printf("value: ", elem->tag);
    switch (elem->tag)
    {
    case TAB_TAG_DEC:
        printf("%f\n", elem->valDec);
        break;
    case TAB_TAG_HEX:
        printf("%x\n", elem->valHex);
        break;
    case TAB_TAG_INT:
        printf("%d\n", elem->valInt);
        break;
    case TAB_TAG_STR:
        printf("%s\n", elem->valStr);
        break;
    case TAB_TAG_TAB:
        printf("%p\n", elem->valTab);
        break;
    default:
        printf("NIL\n");
        break;
    }
    printf("====TabElem End====\n");
}
